@import '@folio/stripes-components/lib/variables';

.toggle-switch-slider {
  background-color: var(--label-color);
  border-radius: 34px;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: 0.4s;
}

.toggle-switch-slider::before {
  background-color: #fff;
  border-radius: 50%;
  bottom: 4px;
  content: "";
  height: 26px;
  left: 4px;
  position: absolute;
  transition: 0.4s;
  width: 26px;
}

.toggle-switch {
  display: inline-block;
  position: relative;
  height: 34px;
  width: 60px;

  & input {
    /* makes input visually hidden but accessible */
    position: absolute;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }

  &.is-pending .toggle-switch-slider {
    animation: toggle-pending 3s infinite ease-in-out;
  }

  & input:checked + .toggle-switch-slider {
    background-color: var(--success);
  }

  & input:disabled + .toggle-switch-slider {
    background-color: var(--secondary);
  }

  & input:checked + .toggle-switch-slider::before {
    transform: translateX(26px);
  }
}

@keyframes toggle-pending {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}
